package com.ssc.manager.admin.service.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ssc.manager.admin.dao.IConfigDao;
import com.ssc.manager.admin.dto.ConfigDto;
import com.ssc.manager.admin.entity.db.Config;
import com.ssc.manager.admin.service.IConfigDataService;
import com.ssc.manager.common.base.service.BaseService;
import com.ssc.manager.common.cache.Cache;
import com.ssc.manager.common.constant.SystemConstant;
import com.ssc.manager.common.system.SystemData;


@Service
public class ConfigDataService extends BaseService<Config> implements IConfigDataService {

	@Override
	public void initData() {
		// TODO Auto-generated method stub
		
	}
	/*private Logger log = Logger.getLogger(ConfigDataService.class);
	
	@Autowired
	private IConfigDao configDao;
	
	@Autowired
	private Cache cache;
	@Override
	public void initData() {
		initConfig();
		initCache();
	}
	
	private void initConfig(){
		List<Config> configs = configDao.selectList(new Config());
		if(null != configs && configs.size()>0){
			Config config = configs.get(0);
			ConfigDto configDto = new ConfigDto();
			configDto.setId(config.getId());
			configDto.setOpenGames(config.getOpenGame().split(SystemConstant.OPENSPLIT));
			configDto.setOpenKlsf(config.getOpenKlsf().split(SystemConstant.OPENSPLIT));
			*//**
			 * 还有其它
			 * bobo
			 *//*
			SystemData.setSystemConfig(configDto);
		}else{
			log.info("系统初始货config时失败,原因："+"db中config为空");
		}
	}
	
	*//**
	 * 
	* 方法名称: initCache
	* 描述: 初始化cache 因为玩法cache都是固定的，所以初始化位置
	* 参数： 
	* @throws
	 *//*
	private void initCache(){
		if(null != SystemData.systemConfig ){
			for(String gameName : SystemData.systemConfig.getOpenGames()){
				if(!cache.exists(gameName+SystemConstant.OPENKEY)){
					if(SystemConstant.KLSF.equals(gameName)){
						initGameCache(gameName+SystemConstant.OPENKEY,SystemData.systemConfig.getOpenKlsf());
					}else if(true){
						*//**
						 * 还有其它判断
						 * bobo
						 * ......
						 *//*
					}
				}
			}
			
		}
	}
	
	*//**
	 * 
	* 方法名称: initGameCache
	* 描述:初始化cache
	* 参数：@param OpenGameKey
	* 参数：@param openPlays 
	* @throws
	 *//*
	private void initGameCache(String OpenGameKey,String [] openPlays){
		for(String play : openPlays){
			cache.rightPush(OpenGameKey, play);
		}
	}*/

}
